from pymysql import Connection

conn = Connection(
    host="127.0.0.1",
    port=3306,
    user="root",
    password="123456",
    autocommit=True
)
print(conn.get_server_info())
cursor = conn.cursor()
conn.select_db("dym")
cursor.execute("select * from test")
res = cursor.fetchall()
print(res)
conn.close()
